package com.google.gson.internal.bind;

import com.google.gson.Gson;
import com.google.gson.TypeAdapter;
import com.google.gson.reflect.TypeToken;
import com.google.gson.stream.JsonReader;
import com.google.gson.stream.JsonWriter;

import java.io.IOException;
import java.lang.reflect.Type;

public class TypeAdapterRuntimeTypeWrapper<T> extends TypeAdapter<T> {
    private final Gson context;
    private final Type type;

    public TypeAdapterRuntimeTypeWrapper(Gson context, Type type) {
        this.context = context;
        this.type = type;
    }

    @Override
    public void write(JsonWriter out, T value) throws IOException {
        TypeAdapter<T> chosen = (TypeAdapter<T>) context.getAdapter(TypeToken.get(type));
        chosen.write(out, value);
    }

    @Override
    public T read(JsonReader in) throws IOException {
        return null;
    }
}
